CROSS_COMPILE ?= 

PREFIX ?= ./build
HOST ?=

# 创建中间文件生成目录
# $(shell mkdir -p $(BIN_DIR))
# $(shell mkdir -p $(LIB_DIR))
# $(shell mkdir -p $(INC_DIR))
# $(shell mkdir -p $(OBJ_DIR))

SUBFOLDER := $(shell ls -l |awk '/^d/ {print $$NF}')

all: $(SUBFOLDER)
	@for subdir in $(SUBFOLDER); do \
		$(MAKE) CROSS_COMPILE=$(CROSS_COMPILE) PREFIX=$(PREFIX) HOST=$(HOST) -C $$subdir;\
	done

clean:
	@for subdir in $(SUBFOLDER) $(MASTERDIR); do \
		$(MAKE) PREFIX=$(PREFIX) HOST=$(HOST) -C $$subdir clean;\
		done

install:
	@for subdir in $(SUBFOLDER) $(MASTERDIR); do \
		$(MAKE) PREFIX=$(PREFIX) HOST=$(HOST) -C $$subdir install;\
		done
